問題描述
使用帶有 Curl 的緩衝輸出將文件上傳到 ftp 服務器 (Upload a file into a ftp server using buffered output with Curl)
I want to upload a database backup file into an external ftp server using curl. I use postgres and pg_dump streams the content of file into buffered output. I tried
echo pg_dump dbname| gzip" | curl ‑d @‑ ftp://user:pass@host:/pg_dump/$(date +"%Y%m%d%H%M")_dump.gz
but it doesn't work. Any suggestion?
參考解法
方法 1:
I tried
pg_dumpall | gzip | curl ‑T ftp://user:pass@host:/pg_dump/$(date +"%Y%m%d%H%M")_dump.gz
and it worked.
(by burak emre、burak emre)